#  Copyright (c) 2007 Microsoft Corporation. All rights reserved.

module VMXT2TFS
  #This module holds the templates used to generate the TFS XML
  module Templates
    #accepted project types
    PROJECT_TYPES=["174b8106fb0c445f","1369cfd47f59793"]
    #iteration name
    ITERATION_INITIALISIERUNG="00 Projektinitialisierung"
    #iteration name
    ITERATION_ABSCHLUSS="99 Projektabschluss"
    #iteration name
    ITERATION_ENTWICKLUNG="Entwicklungsabschnitt"
    #Template for the WorkItems.xml file
    WORK_ITEMS_TEMPLATE="WorkItem Tracking/WorkItems.erb"
    #The WorkItems.xml filename
    WORK_ITEMS_FILE="WorkItem Tracking/WorkItems.xml"
    #Template for the WssTasks.xml file
    WSS_TASKS_TEMPLATE="Windows SharePoint Services/WssTasks.erb"
    #The WssTasks.xml filename
    WSS_TASKS_FILE="Windows SharePoint Services/WssTasks.xml"
    #Template for the ProcessTemplate.xml file
    PROCESS_TEMPLATE="ProcessTemplate.erb"
    #The ProcessTemplate.xml filename
    PROCESS_FILE="ProcessTemplate.xml"
    #Template for the Classification.xml file
    CLASSIFICATION_TEMPLATE="Classification/Classification.erb"
    #The Classification.xml filename
    CLASSIFICATION_FILE="Classification/Classification.xml"
    #Template for the GroupsandPermissions.xml file
    ROLES_TEMPLATE="Groups and Permissions/GroupsandPermissions.erb"
    #The GroupsandPermissions.xml filename
    ROLES_FILE="Groups and Permissions/GroupsandPermissions.xml"
    #Template for the ReportsTasks.xml file
    REPORTS_TEMPLATE="Reports/ReportsTasks.erb"
    #The ReportsTasks.xml filename
    REPORTS_FILE="Reports/ReportsTasks.xml"
    
    #List of the ERB templates that must exist
    TEMPLATES=[WORK_ITEMS_TEMPLATE,
      WSS_TASKS_TEMPLATE,
      PROCESS_TEMPLATE,
      CLASSIFICATION_TEMPLATE,
      ROLES_TEMPLATE]
    #List of the WIT ERB templates (with filenames)
    WIT_TEMPLATES={"VMXT_Produkt.xml"=>"WorkItem Tracking/TypeDefinitions/VMXT_Produkt.erb"}
    #Hash mapping Entscheidungspunkt to Iteration 
    EP_TO_ITERATION={
    "3650fb30c844c0"=>ITERATION_INITIALISIERUNG,#Angebot abgegeben
    "6674fb30d05e5b"=>ITERATION_ABSCHLUSS,      #Projekt abgeschlossen
    "56f6fb30c54fd7"=>ITERATION_INITIALISIERUNG,#Projekt definiert
    "de21fb30c4aec0"=>ITERATION_INITIALISIERUNG #Projekt genehmigt
    }
    #The GUID of the EP that starts a new Systementwicklung iteration (Iteration geplant)
    START_SE_ITERATION=["101d2fb30cff476"]
    #The GUIDs of the EPs that start a new Entwicklungsabschnitt iteration (Anforderungen festgelegt, Projekt beauftragt)
    START_EA_ITERATION=["16970fb30c68166","645dfb30c8d591"]
    #Partial template used to create default Aktivitaet instances
    DEFAULT_AKTIVITAET=<<EOT
<WI type="Aktivität">
  <FIELD refname="System.Title" value="<%= @title %>" />
  <FIELD refname="System.Description" value="<%= @description %>" />
  <FIELD refname="System.State" value="Geplant" />
  <FIELD refname="VMXT.id" value="<%= @vmxt_ref %>" />
  <FIELD refname="VMXT.EPRef" value="<%= milestone_ref %>" />
  <FIELD refname="VMXT.PRef" value="<%= @product_ref %>" />
  <FIELD refname="System.IterationPath" value="<%= iteration %>" />
  <FIELD refname="Microsoft.VSTS.Scheduling.FinishDate" value="<%= end_date %>" />
</WI>
EOT
    #Partial template used to create default Entscheidunkspunkt instances
    DEFAULT_EPUNKT=<<EOT
<WI type="Entscheidungspunkt">
  <FIELD refname="System.Title" value="<%= @title %>" />
  <FIELD refname="System.Description" value="<%= @description %>" />
  <FIELD refname="System.State" value="Geplant" />
  <FIELD refname="VMXT.id" value="<%= @vmxt_ref %>" />
  <FIELD refname="System.IterationPath" value="<%= iteration %>" />
  <FIELD refname="VMXT.Entscheidungspunkttyp" value="<%= @vmxt_type %>" />
  <FIELD refname="Microsoft.VSTS.Scheduling.FinishDate" value="<%= end_date %>" />
</WI>
EOT
    #Partial template used to create default Produkt instances
    DEFAULT_PRODUKT=<<EOT
<WI type="Produkt">
  <FIELD refname="System.Title" value="<%= @title %>" />
  <FIELD refname="System.Description" value="<%= @description %>" />
  <FIELD refname="VMXT.id" value="<%= @vmxt_ref %>" />
  <FIELD refname="VMXT.Erzeugung" value="Initial" />
  <FIELD refname="VMXT.ProduktTyp" value="<%= @vmxt_type %>" />
</WI>
EOT
  REPORT=<<EOT 
<report name="<%=name%>" filename="<%=filename%>" folder="<%=folder%>" cacheExpiration="<%=expiration%>">
  <parameters>
  <% parameters.each do |param| %>  
    <parameter name="<%= param[:name] %>" value="<%= param[:value] %>"/>
  <% end %>
  </parameters>
  <datasources>
    <% datasources.each do |datasource| %>
    <reference name="<%= datasource[:name] %>" dsname="<%= datasource[:dsname] %>"/>
    <% end %>
  </datasources>
</report>
EOT
  end
end